package com.wc.alorithm_blue_bridge._字符串.Q3261;

import java.io.*;

/**
 * @Author congege
 * @Description 位移
 * https://www.lanqiao.cn/problems/3261/learning/?page=1&first_category_id=1
 * @Date Created in 2023/11/26-18:20
 */
public class Main {
    public static void main(String[] args) {
        Input sc = new Input();

        int t = sc.nextInt();
        while (t-- > 0) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            String aStr = Integer.toBinaryString(a);
            String bStr = Integer.toBinaryString(b);
            int idx = bStr.length() - 1;
            while (idx>=0 && bStr.charAt(idx) == '0') {
                idx--;
            }
            bStr = bStr.substring(0, idx + 1);
            if (aStr.contains(bStr)) {
                System.out.println("Yes");
            } else {
                System.out.println("No");

            }
        }
    }

    static class Input {
        StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));

        public int nextInt() {
            try {
                in.nextToken();
            } catch (Exception e) {
                return -1;
            }
            return (int) in.nval;
        }
    }
}
